<template>
  <div class="base-info" v-if="Object.keys(goods).length >= 1">
    <div class="info-title">{{goods.title}}</div>
    <div class="info-price">
      <span class="n-price">{{goods.newPrice}}</span>
      <span class="o-price">{{goods.oldPrice}}</span>
      <span v-if="goods.discount" class="discount">{{goods.discount}}</span>
    </div>
    <div class="info-other">
      <span>{{goods.columns[0]}}</span>
      <span>{{goods.columns[1]}}</span>
      <span>{{goods.services[goods.services.length - 1].name}}</span>
    </div>
    <div class="info-service">
      <span class="info-service-item" v-for="(item,index) in goods.services.length" :key="index">
        <img :src="goods.services[index].icon" alt="">
        <span>{{goods.services[index].name}}</span>
      </span>
    </div>
  </div>
</template>

<script>
  export default {
    name: "DetailBaseInfo",
    props: {
      goods:{
        type:Object,
        default(){
          return {};
        }
      }
    }
  }
</script>

<style scoped>
  .base-info{
    background-color: white;
    font-weight: 500;
    font-size: 15px;
    padding: 10px 5px;
  }
  .info-title{
    color: #222;
  }
  .info-price{
    margin-top: 10px;
  }
  .info-price .n-price{
    color: var(--color-tint);
    font-size: 25px;
  }
  .info-price .o-price{
    font-size: 13px;
    margin-left: 5px;
    text-decoration: line-through;/*中横线*/
  }
  .info-price .discount {
    font-size: 12px;
    padding: 2px 5px;
    color: #ffffff;
    background-color: var(--color-high-text);
    border-radius: 8px;
    margin-left: 5px;
    position: relative;
    top: -8px;
  }
  .info-other{
    margin-top: 15px;
    line-height: 30px;
    display: flex;
    font-size: 13px;
    border-bottom: 1px solid rgba(100,100,100,.1);
    justify-content: space-between;
  }
  .info-service{
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
  }
  .info-service-item img{
    width: 14px;
    height: 14px;
    position: relative;
    top: 2px;
  }
  .info-service-item span{
    font-size: 13px;
    color: #333;
  }
</style>
